<%--
  Created by IntelliJ IDEA.
  User: troy-kou
  Date: 13-12-11
  Time: 下午4:42
  Email:kouhongyu@163.com
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="mis" uri="/lvmama-tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>所有门票产品</title>

    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/style/houtai.css"/>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/themes/base/jquery.ui.all.css"/>

    <script type="text/javascript">
        var basePath = "<%=basePath%>";
    </script>

    <script type="text/javascript" src="<%=request.getContextPath()%>/js/base/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/ui/jquery-ui-1.8.5.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/base/dialog.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/base/task_list.js"></script>

    <style>

        .importbutton {
            padding: 0 10px;
            border: #999 solid 1px;
            height: 18px;
            line-height: 18px;
            cursor: pointer;
        }
    </style>
</head>

<body>
<div class="main main02" style="width:98%; padding-top: 3px; padding-bottom: 0px;">
    <div class="row1">
        <form id="query_form" action="<%=basePath%>pub/toTaskList.do" method="post" onsubmit="return querySubmit();">
            <s:hidden name="task.taskId"/>
            <s:hidden name="sort"/>
            <s:hidden name="sortField"/>
            <table border="0" cellspacing="0" cellpadding="0" class="newInput" width="100%">
                <tr>
                    <td><em>名称:</em></td>
                    <td colspan="3"><s:textfield cssClass="newtext1" id="taskName" name="taskName" cssStyle="width: 160px"/></td>
                    <td><em>地址:</em></td>
                    <td colspan="5"><s:textfield cssClass="newtext1" id="webServiceUrl" name="webServiceUrl" cssStyle="width: 280px"/></td>
                    <td><em>参数:</em></td>
                    <td colspan="4"><s:textfield cssClass="newtext1" id="parameter" name="parameter" cssStyle="width: 230px"/></td>
                </tr>
                <tr>
                    <td><em>状态:</em></td>
                    <td>
                        <s:select list="@com.lvmama.task.common.vo.Task$TASK_STATUS@values()"
                                  listKey="code" listValue="cnName"
                                  headerKey="" headerValue="选择"
                                  name="status" value="status"
                                  cssStyle="width: 60px;"/>
                    </td>
                    <td><em>启用:</em></td>
                    <td align="right">
                        <s:select list="@com.lvmama.task.common.vo.Task$TASK_AVAILABLE@values()"
                                  listKey="code" listValue="cnName"
                                  headerKey="" headerValue="选择"
                                  name="available" value="available"
                                  cssStyle="width: 60px;"/>
                    </td>
                    <td><em>周期:</em></td>
                    <td>
                        <s:select list="@com.lvmama.task.common.vo.Task$TASK_CYCLE@values()"
                                  listKey="code" listValue="cnName"
                                  headerKey="" headerValue="选择"
                                  name="cycle" value="cycle"
                                  cssStyle="width: auto;"/>
                    </td>
                    <td><em>结果:</em></td>
                    <td>
                        <s:select list="@com.lvmama.comm.pet.po.pub.TaskResult$RUN_STATUS@values()"
                                  listKey="code" listValue="cnName"
                                  headerKey="" headerValue="选择"
                                  name="lastRunStatus" value="lastRunStatus"
                                  cssStyle="width: auto;"/>
                    </td>
                    <td><em>ID:</em></td>
                    <td align="right"><s:textfield cssClass="newtext1" id="taskId" name="taskId" cssStyle="width: 50px"/></td>
                    <td><em>环境:</em></td>
                    <td><s:textfield cssClass="newtext1" id="owner" name="owner" cssStyle="width: 50px"/></td>
                     <td><em>节点:</em></td>
                    <td><s:textfield cssClass="newtext1" id="jobNode" name="jobNode" cssStyle="width: 50px"/></td>
                    <td>
                        <input id="refreshQuery" name="refreshQuery" type="checkbox" <s:if test="refreshQuery != null">checked</s:if>/>自动刷新
                    </td>
                    <td>
                        <input type="submit" class="button" value="查 询"/>
                        <input type="hidden" name="perPageRecord" value="<s:property value="pagination.perPageRecord"/>"/>
                    </td>
                </tr>
            </table>
        </form>
        <form action="<%=basePath%>pub/importTaskList.do" method="post" enctype="multipart/form-data"
              onsubmit="if (!$('#uploadFile').val()) {alert('请选择文件！'); return false;} else {return true;} ">
            <table>
                <tr>
                    <td>
                        <input type="button" class="button" id="immediatelyRunButton" value="立即运行"/>
                    </td>
                    <td>
                        <input type="button" class="button" id="enableDisableButton" value="启/停用"/>
                    </td>
                    <td>
                        <input type="button" class="button" id="interruptButton" value="中断"/>
                    </td>
                    <td>
                        <input type="button" class="button" id="addTaskButton" value="新 增"/>
                    </td>
                    <td>
                        <input type="button" class="button" id="copyTaskButton" value="复 制"/>
                    </td>
                    <td>
                        <input type="button" class="button" id="batchModifyButton" value="批量更新"/>
                    </td>
                    <td style="display: none;">
                        <input type="button" class="button" id="delTaskButton" value="删 除"/>
                    </td>
                    <td>
                        <input type="button" class="button" id="exportTaskButton" value="导出"/>
                    </td>
                    <td>
                        <input type="submit" value=" 导入" class="button"/>
                    </td>
                    <td>
                        <input style="margin-left: 10px;" type="file" name="upload" id="uploadFile"/>
                    </td>
                    <td>
                        <span style="font-weight:bold;">${message}</span>
                    </td>
                </tr>
            </table>
        </form>
    </div>

    <div class="row2">
        <table border="0" cellspacing="0" cellpadding="0" class="newTable" style="text-align: center;">
            <tr class="newTableTit">
                <td style="width: 30px"><input type="checkbox" id="checkboxAll"></td>
                <td style="width: 60px">
                    <a href="javascript:void(0);" style="font-size: 14px;"
                            <s:if test="sort == 'ASC'">
                                onclick="sortQuery('DESC','TASK_ID')"
                            </s:if>
                            <s:elseif test="sort == 'DESC'">
                                onclick="sortQuery('ASC','TASK_ID')"
                            </s:elseif>
                            <s:else>
                                onclick="sortQuery('ASC','TASK_ID')"
                            </s:else>
                    >
                        ID
                    </a>
                </td>
                <td>
                    <a href="javascript:void(0);" style="font-size: 14px;"
                            <s:if test="sort == 'ASC'">
                                onclick="sortQuery('DESC','TASK_NAME')"
                            </s:if>
                            <s:elseif test="sort == 'DESC'">
                                onclick="sortQuery('ASC','TASK_NAME')"
                            </s:elseif>
                            <s:else>
                                onclick="sortQuery('ASC','TASK_NAME')"
                            </s:else>
                    >
                        名称
                    </a>
                </td>
                <td style="width: 50px">状态</td>
                <td style="width: 50px">启用</td>
                <td style="width: 90px">周期</td>
                <td style="width: 140px">下次运行时间</td>
                <td style="width: 140px">上次运行时间</td>
                <td style="width: 80px">
                    <a href="javascript:void(0);" style="font-size: 14px;"
                            <s:if test="sort == 'ASC'">
                                onclick="sortQuery('DESC','LAST_TIME_CONSUMING')"
                            </s:if>
                            <s:elseif test="sort == 'DESC'">
                                onclick="sortQuery('ASC','LAST_TIME_CONSUMING')"
                            </s:elseif>
                            <s:else>
                                onclick="sortQuery('ASC','LAST_TIME_CONSUMING')"
                            </s:else>
                    >
                        上次耗时
                    </a>
                </td>
                <td style="width: 70px">结果</td>
                <td style="width: 100px">节点</td>
                <td style="width: 90px">环境</td>
            </tr>

            <s:iterator value="taskList">
                <tr title="地址：<s:property value="webServiceUrl"/>&#13;计划时间：<s:date name="lastTime" format="yyyy-MM-dd HH:mm:ss"/>&#13;周期尺度：<s:property value="cycleDimension"/>&#13;调用类型：<s:property value="requestType"/>">
                    <td>
                        <input type="checkbox" class="taskIdClass" value="<s:property value="taskId"/>">
                    </td>
                    <td>
                        <a href="javascript:void(0);" onclick="showTaskOperationLogList(${taskId})">
                            <s:property value="taskId"/>
                        </a>
                    </td>
                    <td style="text-align: left;padding-left: 5px;">
                        <a href="javascript:void(0);" onclick="showTask(${taskId})"><s:property value="taskName"/></a>
                    </td>
                    <td>
                        <s:if test="status=='WAIT'">
                        <span style="color: darkgoldenrod;font-weight: bold;">
                        <s:property value="@com.lvmama.task.common.vo.Task$TASK_STATUS@getCnName(status)"/>
                        </span>
                        </s:if>
                        <s:if test="status=='RUN'">
                        <span style="color:darkgreen;font-weight: bold;">
                        <s:property value="@com.lvmama.task.common.vo.Task$TASK_STATUS@getCnName(status)"/>
                            <img src="<%=basePath%>images/ajaxload.gif" width="10px;" height="10px;">
                        </span>
                        </s:if>
                        <s:if test="status=='END'">
                        <span style="color:darkblue;font-weight: bold;">
                        <s:property value="@com.lvmama.task.common.vo.Task$TASK_STATUS@getCnName(status)"/>
                        </span>
                        </s:if>
                    </td>
                    <td>
                        <s:if test="available=='ENABLE'">
                        <span style="color:darkgreen;font-weight: bold;">
                        </s:if>
                        <s:else>
                        <span style="color:dimgray;">
                        </s:else>
                            <s:property value="@com.lvmama.task.common.vo.Task$TASK_AVAILABLE@getCnName(available)"/>
                        </span>
                    </td>
                    <td>
                        <s:property value="@com.lvmama.task.common.vo.Task$TASK_CYCLE@getCnName(cycle)"/>
                    </td>
                    <td>
                        <s:date name="nextRunTime" format="yyyy-MM-dd HH:mm:ss"/>
                    </td>
                    <td>
                        <s:date name="lastTime" format="yyyy-MM-dd HH:mm:ss"/>
                    </td>
                    <td style="text-align: right;padding-right: 15px;">
                        <s:property value="lastTimeConsumingFormat"/>
                    </td>
                    <td>
                        <a href="javascript:void(0);" onclick="showTaskJobLogList(${taskId})">
                            <s:if test="lastRunStatus == null">
                                -
                            </s:if>
                            <s:else>
                                <s:property value="lastRunStatus.getCnName()"/>
                            </s:else>
                        </a>

                    </td>
                    <td>
                        <s:property value="jobNode"/>
                    </td>
                    <td>
                        <s:property value="owner"/>
                    </td>
                </tr>
            </s:iterator>
        </table>
    </div>
    <table width="90%" border="0" align="center">
        <s:include value="/WEB-INF/pages/back/base/pag.jsp"/>
    </table>

</div>
<div id="task_div" url="${basePath}pub/showTaskDialog.do"></div>
<div id="task_job_log_div" url="${basePath}pub/showTaskJobLogDialog.do"></div>
<div id="copy_task_div" url="${basePath}pub/copyTaskDialog.do"></div>
<div id="task_job_log_info_div" url="${basePath}pub/showTaskJobLogInfoDialog.do"></div>
<div id="batch_modify_task_div" url="${basePath}pub/showTaskBatchModifyDialog.do"></div>
<div id="task_operation_log_div" url="${basePath}pub/showTaskOperationLogDialog.do"></div>
</body>
</html>


